/**
 * Created by Jack Xue on 20101023
 */
package org.code.jack.jweberp.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

@Entity
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class User implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.TABLE)
	private Long id;

	/**
	 * 用户编号
	 */
	@Column(length = 20)
	private String sn;

	/**
	 * 用户姓名
	 */
	@Column(length = 32, unique = true)
	private String userName;

	/**
	 * 用户真实姓名
	 */
	@Column(length = 32)
	private String actualName;

	/**
	 * 用户密码
	 */
	@Column(length = 32)
	private String password = "000000";

	/**
	 * 用户注册时间
	 */
	private Date registerTime = new Date();

	/**
	 * 用户状态
	 */
	private Integer status = 0;// -2回收站(删除) -1锁定、0未审核、1正常

	/**
	 * 管理员
	 */
	private Integer isAdmin = 0;// 0非管理员、1管理员

	/**
	 * 登陆次数
	 */
	private Integer loginTimes = 0;

	/**
	 * 最后登陆时间
	 */
	private Date lastLoginTime = new Date();

	/**
	 * 最后登陆IP
	 */
	@Column(length = 16)
	private String lastLoginIP;

	/**
	 * 找回密码所需的提问
	 */
	@Column(length = 24)
	private String problem;

	/**
	 * 找回密码所需的答案
	 */
	@Column(length = 24)
	private String solution;

	/**
	 * 上次退出系统时间
	 */
	private Date lastLogoutTime;
	
	/**
	 * 雇员
	 */
	private Employee employee;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getSn() {
		return sn;
	}

	public void setSn(String sn) {
		this.sn = sn;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getActualName() {
		return actualName;
	}

	public void setActualName(String actualName) {
		this.actualName = actualName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Date getRegisterTime() {
		return registerTime;
	}

	public void setRegisterTime(Date registerTime) {
		this.registerTime = registerTime;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getIsAdmin() {
		return isAdmin;
	}

	public void setIsAdmin(Integer isAdmin) {
		this.isAdmin = isAdmin;
	}

	public Integer getLoginTimes() {
		return loginTimes;
	}

	public void setLoginTimes(Integer loginTimes) {
		this.loginTimes = loginTimes;
	}

	public Date getLastLoginTime() {
		return lastLoginTime;
	}

	public void setLastLoginTime(Date lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}

	public String getLastLoginIP() {
		return lastLoginIP;
	}

	public void setLastLoginIP(String lastLoginIP) {
		this.lastLoginIP = lastLoginIP;
	}

	public String getProblem() {
		return problem;
	}

	public void setProblem(String problem) {
		this.problem = problem;
	}

	public String getSolution() {
		return solution;
	}

	public void setSolution(String solution) {
		this.solution = solution;
	}

	public Date getLastLogoutTime() {
		return lastLogoutTime;
	}

	public void setLastLogoutTime(Date lastLogoutTime) {
		this.lastLogoutTime = lastLogoutTime;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

}